/*
 * @Descripttion: 
 * @version: 
 * @Author: by
 * @Date: 2021-05-24 15:14:42
 * @LastEditors: tc
 * @LastEditTime: 2022-01-13 11:17:35
 */
import {createApp} from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'element-plus/lib/theme-chalk/index.css'
import Table from '@/components/table/table.vue'
import tableMixin from './mixins/tableMixin'

// import './theme/index.css'
import installElementPlus from './plugins/element'
import dataV from '@jiaminghi/data-view'
import * as echarts from 'echarts'
import 'echarts-liquidfill';
import TEditor from '@/components/TEditor'
import print from 'vue3-print-nb'

const app = createApp(App)
app.component('TEditor', TEditor)
// 自定义权限指定
// app.directive('hasPermission', {
//     beforeMount(el, binding) {
//         let permissions = JSON.parse(window.localStorage.getItem('permissions'))
//         if(!permissions) {
//             return
//         }
//         let value = binding.value
//         let flag = true
//         if (!permissions.includes(value)) {
//             flag = false
//         }
//         if (!flag) {
//             if (!el.parentNode) {
//                 el.style.display = 'none'
//             } else {
//                 el.parentNode.removeChild(el)
//             }
//         }
//     }
// })

app.config.globalProperties.$echarts = echarts
app.component('Table' ,Table)
installElementPlus(app)

app
    .mixin(tableMixin)
    .use(dataV)
    .use(print)
    .use(store)
    .use(router)
    .mount('#app')